#include <iostream>
using namespace std;

class Clock
{
  private:
    int H, M, S;

    int getH()
    {
        return H;
    }

  public:
    Clock(int h = 0, int m = 0, int s = 0);
    ~Clock()
    {
        printf("destructor: %02d:%02d:%02d\n", H, M, S);
    }

    void setTime(int h, int m, int s)
    {
        this->H = h >= 0 && h <= 24 ? h : 0;
        M = m >= 0 && m <= 60 ? m : 0;
        S = s >= 0 && s <= 60 ? s : 0;
    }

    void showTime(); // declare member function

    int GetH()
    {
        return getH();
    }
};

Clock::Clock(int h, int m, int s)
{
    H = h >= 0 && h <= 24 ? h : 0;
    M = m >= 0 && m <= 60 ? m : 0;
    S = s >= 0 && s <= 60 ? s : 0;
}

inline void Clock::showTime()
{
    // cout << H << ":" << M << ":" << S << endl;
    printf("%02d:%02d:%02d\n", H, M, S);
}

Clock MyClock;
int main()
{
    MyClock.showTime();
    MyClock.setTime(8, 36, 8);
    MyClock.showTime();
    int i(2);
    printf("%d\n", i);
    /* int a1;
    scanf("%d", &a1);
    printf("%s,%d\n", "asdf", a1); */

    cout << endl;
    Clock *cp = new Clock(2, 12, 45);
    cp->showTime();
    cp->setTime(3, 12, 90);
    cp->showTime();
    int a2 = cp->GetH();
    printf("小时为%d\n\n", a2);
    delete cp;
}